local assets =
{
    Asset("ANIM", "anim/yuemiheng_equipment.zip"),
	Asset("ATLAS", "images/yuemiheng_backpack.xml"), 
    Asset("IMAGE", "images/yuemiheng_backpack.tex"),
}

local function OnBlocked(owner, data) 
    owner.SoundEmitter:PlaySound("dontstarve/wilson/hit_armour")
end

local function onequip(inst, owner)
        owner.AnimState:OverrideSymbol("backpack", "yuemiheng_equipment", "0000000")
        owner.AnimState:OverrideSymbol("swap_body_tall", "yuemiheng_equipment", "0000000")

end

local function onunequip(inst, owner)
    owner.AnimState:ClearOverrideSymbol("swap_body_tall")
    owner.AnimState:ClearOverrideSymbol("backpack")

end

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    MakeInventoryPhysics(inst)

    inst.AnimState:SetBank("yuemiheng_backpack") 
    inst.AnimState:SetBuild("yuemiheng_equipment")
    inst.AnimState:PlayAnimation("idle",true)

    inst:AddTag("wood")

    inst.foleysound = "dontstarve/movement/foley/logarmour"

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("inspectable") 

    inst:AddComponent("inventoryitem")
	inst.components.inventoryitem.atlasname = "images/yuemiheng_backpack.xml"  
    
	inst:AddComponent("waterproofer") 
    inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_ABSOLUTE)

    inst.components.equippable:SetOnEquip(onequip)
    inst.components.equippable:SetOnUnequip(onunequip)

    MakeHauntableLaunch(inst)

    return inst
end

return Prefab("yuemiheng_backpack", fn, assets) 
